#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int N = 1e6+10;

int sa[N],rk[N],ork[N<<1],id[N],px[N],h,n,p,m,cnt[N];
char s[N];

inline bool cmp(int x,int y){return ork[x] == ork[y] && ork[x + h] == ork[y + h];}

void getSA(){
	m = 300; for(int i = 1;i <= n;i++) ++cnt[rk[i] = s[i]];
	for(int i = 1;i <= m;i++) cnt[i] += cnt[i-1];
	for(int i = n;i >= 1;i--) sa[cnt[rk[i]]--] = i;
	for(h = 1;h <= n;h <<= 1,m = p){
		p = 0; for(int i = n;i > n - h;i--) id[++p] = i;
		for(int i = 1;i <= n;i++) if(sa[i] > h) id[++p] = sa[i] - h;
		for(int i = 1;i <= m;i++) cnt[i] = 0;
		for(int i = 1;i <= n;i++) ++cnt[px[i] = rk[id[i]]];
		for(int i = 1;i <= m;i++) cnt[i] += cnt[i-1];
		for(int i = n;i >= 1;i--) sa[cnt[px[i]]--] = id[i];
		for(int i = 1;i <= n;i++) ork[i] = rk[i];
		p = 0; for(int i = 1;i <= n;i++) rk[sa[i]] = cmp(sa[i-1],sa[i]) ? p : ++p;
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	scanf("%s",s + 1); n = strlen(s + 1);
	getSA(); for(int i = 1;i <= n;i++) printf("%d%c",sa[i]," \n"[i == n]);
	return 0;
}
